//1.0 导入vue核心包
import Vue from 'vue';

//2.0 导入App.vue的vue对象
import App from './App.vue';

//3.0 将vue-router集成到这个项目中来
import vueRouter from 'vue-router';

//3.0.1 将 vueRouter对象绑定到Vue对象上
Vue.use(vueRouter);

//使用图片预览插件
import VuePreview from 'vue-preview';
Vue.use(VuePreview); //默认的使用

//3.0.2 导入路由规则对应的组件对象
import Home from './components/Home.vue';
// import Car from './components/car.vue';
import Vip from './components/vip.vue';
import Search from './components/search.vue';

import newslist from './components/news/newslist.vue';
import newsinfo from './components/news/newsinfo.vue';

import photolist from './components/photo/photolist.vue';
import photoinfo from './components/photo/photoinfo.vue'

import goodslist from './components/goods/goodslist.vue'
import goodsinfo from './components/goods/goodsinfo.vue'

import goodsdesc from './components/goods/goodsdesc.vue'
import goodsdescomment from './components/goods/goodsdescomment.vue'

import shopcar from './components/shopcar/car.vue'

//3.0.3 定义路由规则
var router = new vueRouter({
    //路由激活的时候附加的CSS样式高亮的类名  这个可以指定更变linkActiveClass指定
    linkActiveClass:'mui-active',
    routes:[
        {path:'/',redirect:'/home',component:Home},         //VUE2.0 主页重定向  path:'/',redirect:'/home',component:Home 其中一个就可以 路径或者  组件
        {path:'/home',component:Home},
        // {path:'/car',component:Car},
        {path:'/vip',component:Vip},
        {path:'/search',component:Search},
        {path:'/news/newslist',component:newslist},
        {path:'/news/newsinfo/:id',component:newsinfo},
        {path:'/photo/photolist',component:photolist},
        {path:'/photo/photoinfo/:id',component:photoinfo},
        {path:'/goods/goodslist',component:goodslist},
        {path:'/goods/goodsinfo/:id',component:goodsinfo},
        {path:'/goods/goodsdesc/:id',component:goodsdesc},
        {path:'/goods/goodsdescomment/:id',component:goodsdescomment},
        {path:'/shopcar/car',component:shopcar},
    ]
});


//4.0 注册 mint-ui
import 'mint-ui/lib/style.css';     //导入CSS文件
import Mint from 'mint-ui';
//在vue中全局使用mint-ui
Vue.use(Mint);


//5.0方式注册mui
import './css/mui.css';

//导入site.css
import './css/site.css';


import vueResource from 'vue-resource'
Vue.use(vueResource)

import moment from 'moment';
Vue.filter('datefmt',function(input,fmtstring){

    return moment(input).format(fmtstring);
});

//5.0 vue渲染
new Vue({
    el:'#app',
    //对象使用这个路由规则
    router:router,
    //render:function (create) { create(App) }  //es5写法
    render:c=>c(App)    //es6的函数写法 =>: goes to  左边C是参数  c(App)是方法体

    
    //render:(c)=>{c(App);}           //有多个参数 (c)的小括号不能省略    { 内有多条语句  大括号不能省略 还有分号也不能省略}
})

